资讯动态

C Primer Plus第六版第15章编程练习第4题

发布时间:2026/8/11 4:55:55 来源:尧图企业网站定制
4.编写一个程序接受两个int类型的参数一个是值一个是值的位置。如果指定位置是1该函数返回1否则返回0。在一个程序中测试该函数。#include stdio.h int function1(int,int); int main(void) { int num,loc; printf(enter a integer and the location:); if(scanf( %d %d,num,loc)2) { if(loc0loc32) printf(%d s %d bit is %d\n,num,loc,function1(num,loc)); else { puts(wrong!); return -1; } } return 0; } int function1(int a,int b) { int result 0; ab; resulta1; return result; }

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价